<!-- BEGIN PAGE CONTAINER-->
<div class="container-fluid">
<!-- BEGIN PAGE HEADER-->
<div class="row-fluid">
    <div class="span12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            Quản lý sản phẩm
        </h3>
        <ul class="breadcrumb">
            <li>
                <i class="icon-home"></i>
                <a href="index.html">Trang chủ</a>
                <i class="icon-angle-right"></i>
            </li>
            <li>
                <a href="#">Sản phẩm</a>
                <i class="icon-angle-right"></i>
            </li>
            <li><a href="#">Thêm mới sản phẩm</a></li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row-fluid">
    <div class="span12">
        <!-- BEGIN EXAMPLE TABLE PORTLET-->
        <div class="portlet box light-grey">
            <div class="portlet-title">
                <h4><i class="icon-plus-sign"></i>Thêm mới sản phẩm</h4>

                <div class="tools">
                    <a href="javascript:;" class="collapse"></a>
                </div>
            </div>
            <div class="portlet-body form">
                <!-- BEGIN FORM-->
                <?php $form=$this->beginWidget('CActiveForm', array(
                    'action'=> '/admin/products/create',
                    'htmlOptions' => array('class'=>'horizontal-form'),
                    'enableAjaxValidation'=>false
                ));
                CHtml::$errorContainerTag = 'span';
                ?>
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="control-group <?php if ($form->error($model,'title') != "") echo "error"; ?>">
                                <label class="control-label" for="firstName">Tên</label>

                                <div class="controls">
                                    <?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>45, 'class'=>'m-wrap span12')); ?>
                                    <?php echo $form->error($model,'title', array('class'=>'help-block')); ?>
                                </div>
                            </div>
                        </div>
                        <!--/span-->
                        <div class="span6">
                            <div class="control-group">
                                <label class="control-label" for="lastName">Kích thước</label>

                                <div class="controls">
                                    <?php echo $form->textField($model,'size',array('size'=>60,'maxlength'=>45, 'class'=>'m-wrap span12')); ?>
                                    <?php echo $form->error($model,'size', array('class'=>'help-block')); ?>
                                </div>
                            </div>
                        </div>
                        <!--/span-->
                    </div>
                    <!--/row-->
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="control-group <?php if ($form->error($model,'product_code') != "") echo "error"; ?>">
                                <label class="control-label" for="firstName">Mã sản phẩm</label>

                                <div class="controls">
                                    <?php echo $form->textField($model,'product_code',array('size'=>60,'maxlength'=>45, 'class'=>'m-wrap span12')); ?>
                                    <?php echo $form->error($model,'product_code', array('class'=>'help-block')); ?>
                                </div>
                            </div>
                        </div>
                        <!--/span-->
                        <div class="span6">
                            <div class="control-group">
                                <label class="control-label" for="lastName">Nhà sản xuất</label>

                                <div class="controls">
                                    <?php echo $form->textField($model,'manufacturer',array('size'=>60,'maxlength'=>255, 'class'=>'m-wrap span12')); ?>
                                    <?php echo $form->error($model,'manufacturer', array('class'=>'help-block')); ?>
                                </div>
                            </div>
                        </div>
                        <!--/span-->
                    </div>
                    <!--/row-->
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="control-group <?php if ($form->error($model,'weight') != "") echo "error"; ?>">
                                <label class="control-label">Trọng lượng</label>

                                <div class="controls">
                                    <?php echo $form->textField($model,'weight',array('size'=>60,'maxlength'=>45, 'class'=>'m-wrap span12')); ?>
                                    <?php echo $form->error($model,'weight', array('class'=>'help-block')); ?>
                                </div>
                            </div>
                        </div>
                        <!--/span-->
                        <div class="span6">
                            <div class="control-group">
                                <label class="control-label">Khung</label>

                                <div class="controls">
                                    <select name="Products[frame_id]" class="m-wrap span12">
                                        <option value="">Vui lòng chọn khung</option>
                                        <option value="">Không có</option>
                                        <?php
                                        $frames = ProductFrame::model()->findAll();
                                        if($frames){
                                            foreach($frames as $frame) {?>
                                                <option value="<?php echo $frame->frame_id;?>"><?php echo $frame->name;?></option>
                                            <?php }
                                        }
                                        ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <!--/span-->
                    </div>
                    <!--/row-->
                    <div class="row-fluid">
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label" >Giá</label>
                                <div class="controls">
                                    <div class="input-prepend input-append"> <span class="add-on">$</span>
                                        <?php echo $form->textField($model,'price',array('class'=>'m-wrap', 'style'=>'width:100px')); ?>
                                        <span class="add-on">.00</span>
                                        <?php echo $form->error($model,'price', array('class'=>'help-block')); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="span3" style="">
                            <div class="control-group">
                                <label class="control-label" >Giá mới</label>
                                <div class="controls">
                                    <div class="input-prepend input-append"> <span class="add-on">$</span>
                                        <?php echo $form->textField($model,'new_price',array('class'=>'m-wrap', 'style'=>'width:100px')); ?>
                                        <span class="add-on">.00</span>
                                        <?php echo $form->error($model,'new_price', array('class'=>'help-block')); ?>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="span6">
                        </div>
                        <!--/span-->
                        <!--/span-->
                    </div>

                    <!--/row-->
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="control-group <?php if ($form->error($model,'category_id') != "") echo "error"; ?>">
                                <label class="control-label">Danh mục</label>

                                <div class="controls">
                                    <select name="Products[category_id]" class="m-wrap span12" id="selectCategory">
                                        <option value="">Chọn danh mục</option>
                                        <?php
                                        $categories = Category::model()->findAll('is_submenu = 2');
                                        if($categories){
                                            foreach($categories as $category) {?>
                                                <option value="<?php echo $category->category_id;?>"><?php echo $category->title;?></option>
                                            <?php }
                                        }
                                        ?>
                                    </select>
                                    <?php echo $form->error($model,'category_id', array('class'=>'help-block')); ?>
                                </div>
                            </div>
                        </div>
                        <!--/span-->
                        <div class="span6 ">
                            <div class="control-group">
                                <label class="control-label">Danh mục con</label>

                                <div class="controls">
                                    <select name="Products[subId]" class="m-wrap span12 selectSubCategory">
                                        <option value="">Không có danh mục con</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid">
                    	<div class="control-group">
                    		<label class="control-label">Mô tả</label>
                                <div class="controls">
                                    <textarea id="ckeditor" rows="2" name="Products[description]" style="width:97%" class="m-wrap"></textarea>
                                    <?php echo $form->error($model,'description', array('class'=>'help-block')); ?>
                                </div>
                            </div>
                    </div>
                    <div class="row-fluid">
                    	<div class="controls">
                        	<?php echo $form->checkBox($model,'stock', array('checked'=>'checked')); ?><span style="color:#0B9A00"><b>In Stock</b></span>
                        </div>
                    </div>
                    <!--/row-->
                    <br />
                    <div class="form-actions">
                        <button type="submit" class="btn blue"><i class="icon-ok"></i> Lưu</button>
                        <button type="button" onclick="window.location='/admin/products/admin'" class="btn">Hủy</button>
                    </div>
                <?php $this->endWidget(); ?>
                <!-- END FORM-->
            </div>
        </div>
        <!-- END EXAMPLE TABLE PORTLET-->
    </div>
</div>

<!-- END PAGE CONTENT-->
</div>
<!-- END PAGE CONTAINER-->